feat: 서버 집계 함수에 goalIds 필터 추가#3
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Code Review
This pull request introduces the ability to filter dashboard todos by specific goal IDs and fixes character encoding issues in toast messages. Key changes include updating the API route to parse goal IDs, modifying the dashboard component to fetch todos based on visible goals, and refining the data fetching logic. Feedback highlights potential data omission issues due to hardcoded limits: the goal fetch limit (50) may conflict with the client-side limit (100), and the reduced todoFetchLimit for tasks could lead to missing items if they fall outside the fetched range. Additionally, the hardcoded limit of 100 for the goals list should be reviewed for scalability.
| fetchGoals.getGoals(), | ||
| fetchTodos.getTodos({ sort: 'LATEST', search: '', limit: 300, done: false }), | ||
| fetchTodos.getTodos({ sort: 'LATEST', search: '', limit: 300, done: true }), | ||
| fetchGoals.getGoals({ limit: Math.max(targetGoalIds.length, 50) }), |
There was a problem hiding this comment.
fetchGoals.getGoals의 limit이 Math.max(targetGoalIds.length, 50)으로 설정되어 있어 버그가 발생할 가능성이 있습니다. 클라이언트(DashboardDetail)에서는 최대 100개의 목표 ID를 보낼 수 있는데, 만약 요청된 ID가 서버의 전체 목표 목록 중 상위 50개 이후에 위치한다면 해당 목표 정보를 가져오지 못하게 됩니다. 클라이언트에서 보낼 수 있는 최대 범위(현재 100개)를 고려하여 limit을 설정해야 합니다.
| fetchGoals.getGoals({ limit: Math.max(targetGoalIds.length, 50) }), | |
| fetchGoals.getGoals({ limit: Math.max(targetGoalIds.length, 100) }), |
| export default function DashboardDetail() { | ||
| const mode = useTodoModeStore((state) => state.mode); | ||
| const { data: goalDetail } = useQuery(dashboardQueries.detailTodos()); | ||
| const { data: goals, isFetched: isGoalsFetched } = useQuery(goalQueries.list({ limit: 100 })); |
| export const getDashboardDetailTodos = async (goalIds?: number[]): Promise<DashboardDetailTodosResult> => { | ||
| const targetGoalIds = normalizeGoalIds(goalIds); | ||
| const targetGoalIdSet = new Set(targetGoalIds); | ||
| const todoFetchLimit = Math.max(SAFE_LIMIT * Math.max(targetGoalIds.length, 1), SAFE_LIMIT * 5); |
There was a problem hiding this comment.
무엇을 변경했나요?
(변경 내용 1~2줄 요약)
왜 이렇게 했나요?
(선택한 이유, 다른 방법 대신 이걸 선택한 이유)
리뷰어가 특히 봐줬으면 하는 부분
스크린샷 (UI 변경 시)